﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using LotteryVote.Logic;
using LotteryVote.Utility;
using LotteryVote.Entity;

namespace LotteryVote.Web
{
    /// <summary>
    /// UpdateGameBetLimit 的摘要说明
    /// </summary>
    public class UpdateGameBetLimit : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string limitStr = context.Request["limit"];
            BetLimitFacade blBetLimit = new BetLimitFacade();
            List<GameBetLimit> betLimits = JSONHelper.ToObject<List<GameBetLimit>>(limitStr);
            try
            {
                blBetLimit.UpdateGameBetLimit(betLimits[0].UserId, betLimits[0].CompanyType, betLimits);
                context.Response.Write("Success");
            }
            catch (Exception ex)
            {
                context.Response.Write(ex.Message);
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}